package com.cn.web.controller.EM.wo_manage;

import com.alibaba.fastjson2.JSONObject;
import com.cn.mapper.dao.db5.EM.wo_manage.WOPlanDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;


@CrossOrigin
@RestController
@RequestMapping("/WOP")
@Transactional
public class WOPlanController {
    private final WOPlanDao woPlanDao;

    @Autowired(required = false)
    public WOPlanController(WOPlanDao woPlanDao) {
        this.woPlanDao = woPlanDao;
    }

    @RequestMapping("/getPars")
    @ResponseBody
    public String getPars(@RequestBody JSONObject jsonObject) {
        System.out.println("aaaaaa:" + jsonObject);
//        woPlanDao.getPars(String.valueOf(jsonObject));
        return woPlanDao.getPars(String.valueOf(jsonObject));

    }

    @RequestMapping("/getShift")
    @ResponseBody
    public String getShift(@RequestBody JSONObject jsonObject) {
        System.out.println("bbbbbb:" + jsonObject);
//        woPlanDao.getPars(String.valueOf(jsonObject));
        return woPlanDao.getShift(String.valueOf(jsonObject));

    }

    @RequestMapping("/getTeamPerson")
    @ResponseBody
    public String getTeamPerson(@RequestBody JSONObject jsonObject) {
        System.out.println("ccccccccc:" + jsonObject);
//        woPlanDao.getPars(String.valueOf(jsonObject));
        String teamPerson = woPlanDao.getTeamPerson(String.valueOf(jsonObject));
        System.out.println("dddd");
        System.out.println(teamPerson);
        return teamPerson;

    }

    @RequestMapping("/getEquipment")
    @ResponseBody
    public String getEquipment(@RequestBody JSONObject jsonObject) {
        System.out.println("dddddddddddd:" + jsonObject);
//        woPlanDao.getPars(String.valueOf(jsonObject));
        return woPlanDao.getEquipment(String.valueOf(jsonObject));

    }

    @RequestMapping("/planInsert")
    @ResponseBody
    public String planInsert(@RequestBody JSONObject jsonObject) {
        System.out.println("eeeeeeeeeeeeeee:" + jsonObject);
//        woPlanDao.getPars(String.valueOf(jsonObject));
//        woPlanDao.planInsert(String.valueOf(jsonObject));
        return "10";

    }
}
